package light.head.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;
/**
 * 固定资产
 */
@Entity
@Table
public class Assets implements Serializable {
	
	private static final long serialVersionUID = -8887795657829154478L;
	
	private Integer code;
	private String name;					//名称
	private Double price;					//价格
	private String norms;					//规格
	private String type;					//型号
	private Integer num;					//数量
	private String buyers;					//购买者
	private Date buyt;						//创建时间
	private String users;					//使用者
	private Integer cu;						//创建人编号
	private Date ct;						//创建时间
	private Integer oc;						//机构
	private Boolean deleted = false;		//是否删除
	private String remark;					//备注
	
	
	private String cn;
	private String on;
	List<AssetsAlteration> itemList;		//使用详情
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public String getName() {
		return name;
	}
	@Column
	public Double getPrice() {
		return price;
	}
	@Column
	public String getNorms() {
		return norms;
	}
	@Column
	public String getType() {
		return type;
	}
	@Column
	public Integer getNum() {
		return num;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable = false, nullable = false)
	public Date getCt() {
		return ct;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Column
	public String getRemark() {
		return remark;
	}
	@Column
	public String getBuyers() {
		return buyers;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column
	public Date getBuyt() {
		return buyt;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu)")
	public String getCn() {
		return cn;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code = oc)")
	public String getOn() {
		return on;
	}
	@Column
	public String getUsers() {
		return users;
	}
	@Transient
	public List<AssetsAlteration> getItemList() {
		return itemList;
	}
	
	
	
	
	
	public void setBuyt(Date buyt) {
		this.buyt = buyt;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setPrice(Double price) {
		this.price = price;
	}
	public void setNorms(String norms) {
		this.norms = norms;
	}
	public void setType(String type) {
		this.type = type;
	}
	public void setNum(Integer num) {
		this.num = num;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public void setBuyers(String buyers) {
		this.buyers = buyers;
	}
	public void setCn(String cn) {
		this.cn = cn;
	}
	public void setOn(String on) {
		this.on = on;
	}
	public void setUsers(String users) {
		this.users = users;
	}
	public void setItemList(List<AssetsAlteration> itemList) {
		this.itemList = itemList;
	}
	
	

}
